<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="initial-scale=1.0, user-scalable=no">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="black">
<title></title>



<link rel="stylesheet"
	href="https://d10ajoocuyu32n.cloudfront.net/mobile/1.3.1/jquery.mobile-1.3.1.min.css">

<!-- Extra Codiqa features -->
<link rel="stylesheet" href="codiqa.ext.css">

<!-- jQuery and jQuery Mobile -->
<script src="https://d10ajoocuyu32n.cloudfront.net/jquery-1.9.1.min.js"></script>
<script
	src="https://d10ajoocuyu32n.cloudfront.net/mobile/1.3.1/jquery.mobile-1.3.1.min.js"></script>

<!-- Extra Codiqa features -->
<script src="https://d10ajoocuyu32n.cloudfront.net/codiqa.ext.js"></script>

<script type="text/javascript">

	$(function(){
		
		
	    $('#member_id').focus();
	    $("#member_pwd").bind("keydown", function(e) {
	        if (e.keyCode == 13) { // enter key
	        	loginAjax();
	            return false;
	        }
	    });
	    
	    
	    
		$("#submit").click(function(){
			loginAjax();
		});
		$("#facebook").click(function(){
			
		});
		$("#google").click(function(){
			
		});
	});
	
	function loginAjax(){
		var loginUrl = "login.ajax";
		param = {
				member_id : $("#member_id").val(),
				member_pwd : $("#member_pwd").val()
		};
		$.ajax({
			url: loginUrl,
			data: param,
			type: 'POST',
			dataType: 'json',
			success : function(response) {
				console.log(response);
				console.log(response.data);
				if(response.code != 200) {
					alert(response.data.msg);
				}else{
					location.href ="../main.do";
				}
			},
			error: function(xhr, status, error) {
				console.log(error);
				console.log(xhr);
				console.log(status);
			}
		});
	}

</script>
</head>
<body  >
	<div data-role="page" style="background: #000000url('../img/main.jpg'); background-size:100% 100%;background-repeat:repeat-y;">
		<div data-role="content" style="margin-top: 75%;">
			<input type="text" id="member_id" placeholder="ID"/>
			<input type="password" id="member_pwd" placeholder="Password" />
	        <a href="#null" id="submit" data-role="button" data-inline="true"> 로그인 </a>
	        <a href="#null" id="submit" data-role="button" data-inline="true"> 등록 </a>
	        <!-- 
	        <a href="#null" id="facebook" data-role="button" > Facebook </a>
	        <a href="#null" id="google" data-role="button" > Google </a>
	         -->
		</div>
	</div>
</body>
</html>
